<template>
    <div>
        <div class="swiper-container">
            <div class="title-container">
                <h1 class="main-title">
                    <strong>专注医药杂质对照品，助力医药研发</strong>
                </h1>
                <h2 class="sub-title">
                    Focus on Pharmaceutical Impurity Standards to Support Drug Development and Research
                </h2>
            </div>
            <div class="swiper-wrapper">
                <div
                    class="swiper-slide"
                    v-for="(slide, index) in slides"
                    :key="index"
                    :style="{ backgroundImage: `url(${slide.image})` }"
                ></div>
            </div>
            <div class="swiper-pagination"></div>
        </div>
        <!-- PC 端 -->
        <div class="pc-content">
            <div class="intro-bg">
                <div class="intro-container">
                    <div class="intro-text">
                        <h1>企业优势</h1>
                        <h2>About Us</h2>
                    </div>
                </div>
            </div>
            <div class="about-section">
                <div class="img-container"></div>
                <div class="left-section">
                    <a href="/about"><img src="../assets/imgs/doctor.png" alt="关于我们" class="intro-image" /></a>
                </div>
                <div class="right-section">
                    <div class="intro-content">
                        <p class="intent">
                            深圳菲斯生物科技有限公司成立于2012年，是一家基于化学和医药科技基础的国家高新技术企业，公司聚焦于为医药科研工作者提供药物分析标准品和杂质对照品，依托于成熟的供应链渠道管理和丰富的化学合成经验，形成以代理国内外知名药物杂质品牌和自主研发、合成药物杂质对照品的工贸一体销售体系，搭建起一个产品数量多、品种齐全、质量可靠、价格合理的药物杂质供应平台。
                        </p>
                        <p class="intent mt-20">
                            公司常备超1万种药物杂质对照品量，涵盖市场常用品种，能快速响应客户需求。同时致力于成为药物杂质对照品领军企业，紧跟市场热点与需求，加大研发投入，加速药物杂质对照品库的建设，以满足医药科研工作者对杂质多样化需求，助力医药研发，促进人类健康。
                        </p>
                        <div class="text-content mt-40">
                            <p class="mr-20">
                                <animated-counter :number="2012" text="年成立"></animated-counter>
                            </p>
                            <p class="mr-20">
                                <animated-counter :number="200000" text="多个可供化合物"></animated-counter>
                            </p>
                            <p class="mr-20">
                                <animated-counter :number="5000" text="多家医药领域客户"></animated-counter>
                            </p>
                            <p>
                                <animated-counter :number="6000" text="多个库存杂质"></animated-counter>
                            </p>
                        </div>
                    </div>
                </div>
            </div>
            <div class="product-bg" style="margin-top: 450px"></div>
            <div class="product-section">
                <div class="intro-container">
                    <div class="intro-text">
                        <h1>产品中心</h1>
                        <h2>Product Center</h2>
                    </div>
                </div>
                <div class="left-section">
                    <a href="/products">
                        <img src="../assets/imgs/yj_bg_32x8.jpg" alt="产品中心" class="intro-image" />
                    </a>
                </div>
                <div class="right-section">
                    <index-product></index-product>
                </div>
            </div>
            <div style="margin-top: 500px">
                <index-new></index-new>
            </div>
            <index-news></index-news>
        </div>
        <!-- 移动 端 -->
        <div class="mobile-content">
            <!-- 产品中心 -->
            <index-product-mobile></index-product-mobile>
            <!-- 关于我们 -->
            <index-about-us-mobile></index-about-us-mobile>
            <!-- 新品发布 -->
            <index-new-mobile></index-new-mobile>
            <!-- 新闻 -->
            <index-news-mobile></index-news-mobile>

            <!-- 底部导航 -->
            <common-footer-menu></common-footer-menu>
        </div>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import Swiper from 'swiper'
import 'swiper/dist/css/swiper.min.css'

import AnimatedCounter from '@/components/AnimatedCounter.vue'
import IndexProduct from '@/components/home/IndexProduct.vue'
import IndexNew from '@/components/home/IndexNew.vue'
import IndexNews from '@/components/home/IndexNews.vue'

// 适配移动端
import IndexNewsMobile from '@/components/home/IndexNewsMobile.vue'
import IndexProductMobile from '@/components/home/IndexProductMobile.vue'
import IndexAboutUsMobile from '@/components/home/IndexAboutUsMobile.vue'
import IndexNewMobile from '@/components/home/IndexNewMobile.vue'
import CommonFooterMenu from '@/components/CommonFooterMenu.vue'

const slides = [
    {
        image: require('../assets/imgs/banner1_n63p.jpg'),
    },
    {
        image: require('../assets/imgs/banner2_63fe.jpg'),
    },
]

const mySwiper = ref(null)

onMounted(() => {
    mySwiper.value = new Swiper('.swiper-container', {
        autoplay: 5000,
        loop: true,
        pagination: '.swiper-pagination',
        paginationClickable: true,
    })
})
</script>
<style lang="scss" scoped>
.swiper-container {
    width: 100%;
    height: 600px;
}

.swiper-slide {
    background-size: cover;
    background-position: center;
    height: 600px;
}

.title-container {
    position: absolute;
    top: 30%;
    left: 15%;
    // transform: translate(-50%, -50%);
    z-index: 2;
}

.main-title {
    font-size: 60px;
    font-weight: bold;
    color: #fff;
    opacity: 0;
    transform: translateX(-100vw);
    animation: slideFromLeft 1.2s ease forwards;
}

.sub-title {
    font-size: 22px;
    color: #fff;
    margin-top: 1rem;
    opacity: 0;
    transform: translateX(100vw);
    animation: slideFromRight 1.2s ease forwards 0.3s;
}

@keyframes slideFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-100vw);
    }
    60% {
        transform: translateX(20px);
    }
    80% {
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideFromRight {
    0% {
        opacity: 0;
        transform: translateX(100vw);
    }
    60% {
        transform: translateX(-20px);
    }
    80% {
        transform: translateX(10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}
@media (max-width: 768px) {
    .main-title {
        font-size: 20px;
    }
    .sub-title {
        font-size: 18px;
    }

    // 轮播图兼容
    .swiper-container {
        height: 233px !important;
    }
    .swiper-slide {
        background-size: cover;
        background-position: center;
        height: 233px !important;
    }
    .title-container {
        top: 65px;
        left: 0;

        .main-title {
            line-height: 1.5;
            margin: 0 auto;
            width: calc(100% - 32px);
            font-weight: bold;
            transform: translateX(0);
            text-align: center;
        }
        .sub-title {
            line-height: 1.5;
            margin: 0 auto;
            width: calc(100% - 32px);
            text-align: center;
            font-size: 14px;
            transform: translateX(0);
        }
    }
}

.intro-bg {
    width: 100%;
    height: 300px;
    background-color: rgb(249, 249, 249);
}
.product-bg {
    width: 100%;
    height: 100px;
    background-color: rgb(249, 249, 249);
}

.intro-container {
    max-width: 1200px;
    height: 300px;
    margin: 0 auto;
    position: relative;
}
.intro-text {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    text-align: left;
}

.about-section,
.product-section {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.img-container {
    position: absolute;
    top: 0px;
    width: 1200px;
    height: 450px;
    background-color: #f0f0f0;
    background-image: url('~@/assets/imgs/about_us.jpg');
    background-size: cover;
    background-position: center;
}

.about-section .left-section {
    left: 50px;
    top: -210px;
    position: absolute;
    z-index: 158;
    width: 550px;
    height: 660px;
    flex-shrink: 0;

    img {
        width: 550px;
        height: 660px;
    }
}

.about-section .right-section {
    position: absolute;
    left: 600px;
    top: -150px;
    z-index: 158;
}

.intro-content {
    background-color: #09a4c3;
    width: 600px;
    height: 600px;
    color: #fff;
    padding: 40px;
    font-size: 14px;

    .text-content {
        columns: 2;
    }

    :deep(.counter-number),
    :deep(.counter-text) {
        color: #fff !important;
    }
}

.product-section {
    .intro-container {
        color: #fff;
        position: absolute;
        width: 340px;
        z-index: 159;
        top: -150px;
        left: 5px;
    }
    .left-section {
        position: absolute;
        left: 0;
        top: -100px;
    }

    .right-section {
        position: absolute;
        left: 340px;
        top: -100px;
    }
}
</style>

<style lang="scss">
.mobile-content {
    display: none;
}

@media (max-width: 768px) {
    .search-content {
        width: calc(100% - 32px);
    }
    .input-with-select {
        .el-input {
            width: 100px !important;
        }
    }

    .mobile-content {
        display: block;
    }
    .pc-content {
        display: none;
    }
}
</style>
